1. Field of the Invention
The present invention relates to TLB (translation look-aside buffer). More particularly, the present invention relates to a method and apparatus for managing a shared TLB.
2. Description of the Related Art
To meet the needs of processing large volumes of information, the demand for processor speed becomes higher and higher. In order to improve processing speed constantly, processing systems have been upgraded from traditional single core processors to multi-core systems, that is, processing data information using a plurality of CPU cores concurrently. Recently, heterogeneous multi-core processing systems have been proposed. The heterogeneous multi-core approach alters the multi-core architecture from traditional homogeneous design to heterogeneous design of “main core+accelerators,” that is, one or more general-purpose cores of the processors implement general computing while other specific computing is done by specialized hardware cores, that is, accelerators or coprocessors, via which the efficiency and performance of the processors can be improved greatly.
FIG. 1 illustrates a block diagram of a heterogeneous multi-core system. As shown in FIG. 1, the processing system includes four CPU cores, also called main cores, and four coprocessors, also called accelerators, which are connected with interfaces and a bus therebetween. The four cores are used to perform all general-purpose tasks and assign specific tasks, while the four coprocessors are used to perform the assigned specific tasks. As specialized hardware, the coprocessors can be exemplarily of any type of DSP (digital signal processors) upon their purpose. For example, these DSP can be a Java interpreter, MPEG video engine, or encrypting/decrypting processor. When performing specific tasks, the coprocessors have much higher efficiency and lower power consumption than general-purpose cores. With this heterogeneous design, the processing system can assign high-load specific tasks to the coprocessors, by which the main cores' operating pressure is reduced greatly and the system efficiency is improved.
Like general processors, when executing all kinds of task processing, coprocessors also use TLB (translation look-aside buffer) to access data. TLB is a part of high-speed cache in the processor used to store some page tables. These page tables are used to perform address mapping and translation in data processing. Specifically, TLB includes a plurality of entries, each of which stores a mapping relation between virtual address and physical address of the memory. Each main core keeps its own TLB because the main cores are used to perform a vast amount of general computing and thus have relatively complex logic. However, for the coprocessors, on the one hand, they need to keep their own TLB to avoid the performance reduction caused by searching TLB entries in the main cores through the bus each time they access data. On the other hand, coprocessors have relatively simple logic for performing relatively simple operations and thus a plurality of coprocessors can share one TLB to save resources. Therefore, one TLB can be embedded in the common interface among a plurality of coprocessors, and be shared by the coprocessors connecting to the interface.
When assigning a job to coprocessors, usually, the main core needs to write address mapping relations of the data related to the job into the TLB used by the coprocessors. This process can be called the initialization of TLB. Then, the main core can start-up the coprocessors to execute data processing after the data is prepared. In this way, the coprocessors access data using the TLB entries written by the main cores and perform specific data processing tasks according to the instructions from the main cores. In many situations, coprocessors need to execute a plurality of jobs or a job queue in time-sharing mode. Besides, as above mentioned, one TLB can be shared by a plurality of coprocessors. That is, a plurality of coprocessors use one TLB to execute a plurality of jobs.
FIG. 2 is a graphic illustration of a plurality of coprocessors sharing one TLB. As shown in the figure, three coprocessors use one TLB to execute data processing together. What is more, each coprocessor exemplarily executes one job queue in time-sharing mode. Therefore, all address mapping relations referenced in all jobs executed by these three coprocessors have to be stored in the one common TLB. However, it's known that the number of entries in TLB is so limited that how to manage and distribute these entries in order to make them shared and used more effectively becomes different.